<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>$provider</title>
</head>
<body ng-app="myApp" ng-controller="firstController">
    <div ng-bind="name"></div>
</body>
</html>

<script src="../libs/AngularJS.min.js"></script>
<script>
    angular
        .module('myApp',[],function ($provide) {
            $provide.provider('Customer',function () {
                this.$get = function () {
                    return {
                        message : '这是自定义的服务!'
                    }
                }
            });
        })
        .controller('firstController',['Customer','$scope',function (Customer,$scope) {
            $scope.name = '张三';
            console.log(Customer.message)
        }]);
</script>